#!/bin/bash

# 前端部署脚本

echo "开始部署前端..."

cd video2text-frontend

# 检查Node环境
echo "检查Node环境..."
if ! command -v node &> /dev/null; then
    echo "错误: 未安装Node.js"
    exit 1
fi

# 检查npm
if ! command -v npm &> /dev/null; then
    echo "错误: 未安装npm"
    exit 1
fi

# 安装依赖
echo "安装Node依赖..."
npm install || exit 1

# 更新API配置
echo "配置API地址..."
# 注意: 需要根据实际后端地址修改
API_HOST="http://your-backend-host:8000"
sed -i "s|baseUrl:.*|baseUrl: '$API_HOST',|" src/config/index.js

# 构建插件
echo "构建Chrome插件..."
npm run build

echo "前端部署完成!" 